import { Column, PrimaryColumn } from 'typeorm'

export class Token {
  @PrimaryColumn({ unique: true })
  declare id: string

  @Column()
  declare accessToken: string

  @Column()
  declare permissions: number

  isUser() {
    const anyThis = this as any
    return anyThis.expiresAt !== undefined && anyThis.refreshToken !== undefined
  }
}
